package bootstrap

import (
	"svntool/system/models/databases"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
)

var db_instance databases.DbInterface = new(databases.Sqlite3DB)

func SetDb(db databases.DbInterface) {
	db_instance = db
}

//初始化数据连接
func connect() {
	db_instance.Connect_db()
}

//初始化表
func build_tables(models ...interface{}) {
	//注册模型
	orm.RegisterModel(models...)

	orm.RunSyncdb(beego.AppConfig.String("db_alias"), false, true)
}
